﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Krile.Forms.ConfigForm.Children
{
    public partial class AppearanceDetail : Krile.Kernel.Control.ConfigPage
    {
        public AppearanceDetail()
        {
            InitializeComponent();
        }

        private void Detail_Load(object sender, EventArgs e)
        {
            this.InterpolateMode.SelectedIndex = (int)Core.Config.Appearance.InterpolateMode;
            this.ToolstripDesign.SelectedIndex = (int)Core.Config.Appearance.ToolStripDesign;
            DateTimeFormat.Text = Core.Config.Appearance.Renderer.Detail.DateTimeFormat;
            linebreakSample.Text = lbsOrigText.Substring(0, (int)TooltipNewlineCount.Value);
            TooltipNewlineCount.Value = Core.Config.Appearance.Renderer.TooltipNewlineCount;
        }

        public override void Apply()
        {
            Core.Config.Appearance.InterpolateMode = (System.Drawing.Drawing2D.InterpolationMode)this.InterpolateMode.SelectedIndex;
            Core.Config.Appearance.ToolStripDesign = (Krile.Cores.Config._Appearance.ToolStripDesigns)this.ToolstripDesign.SelectedIndex;
            Core.Config.Appearance.Renderer.Detail.DateTimeFormat = DateTimeFormat.Text;
            Core.Config.Appearance.Renderer.TooltipNewlineCount = (int)TooltipNewlineCount.Value;
            base.Apply();
        }

        const string lbsOrigText = "This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. This is line-break sample text. ";
        private void TooltipNewlineCount_ValueChanged(object sender, EventArgs e)
        {
            linebreakSample.Text = lbsOrigText.Substring(0, (int)TooltipNewlineCount.Value);
        }
    }
}
